package com.itheima.service.Ipml;

import com.itheima.clients.UserClisents;
import com.itheima.dao.OrderMapper;
import com.itheima.pojo.Order;
import com.itheima.pojo.User;
import com.itheima.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Autowired
    private UserClisents userClisents;

    @Override
    public Order getOrderById(Long orderId) {
        Order order = orderMapper.getOrderById(orderId);
        User user = userClisents.selectUserById(order.getUserId());
        order.setUser(user);
        return order;
    }
}
